import {Component} from "react";
import ChangeIndexs from "./component/ChangeIndexs";
import { Outlet, NavLink } from 'react-router-dom'
import {Button} from "antd";
import './css/practice.scss'

class PracticeIndex extends Component{
    state = {
        formObj: {
            num: 1,
            name: 'lily',
            age: '10'
        }
    }

    add = () => {
        let {formObj} = this.state;
        this.setState({
            formObj: {...formObj, num: formObj.num + 1}
        })
    }


    render() {
        let {formObj} = this.state;
        return (
            <div className={'practice'}>
                <p>这是测试</p>
                <Button type='primary' onClick={this.add}>按1钮</Button>
                <ChangeIndexs obj={formObj} />
                <div className={'lifeNav'}>
                    <NavLink to={'/practice/should'}>should首页</NavLink>
                    <NavLink to={'/practice/life'}>[旧]的生命周期</NavLink>
                </div>
                <Outlet />
            </div>
        )
    }
}

export default PracticeIndex;